# -*- coding: utf-8 -*-
<%inherit file="/base_form.mako"/>

<%!
    from cibynet.lib.utils import filter_dict
%>

<%def name="javascript()">
  ${parent.javascript()}
  ${self.javascript_link('validation/editstudent')}
</%def>

<%def name="editform(student)">
  <%
    keys = ['firstname', 'lastname', 'username', 'email', 'phonenumber']
    value = dict([(k,getattr(student, k)) for k in keys])
    if student.room:
      value.update(room=str(student.room.id) )
    value['object_id'] = student.id
  %>
  ${self.form('user_update_form', 
              value,
              action=h.url_for('student', id=student.id),
              method="PUT",
              )}
</%def>
            
<%def name="body()">
  <h1>
    <% context.write(c.student.firstname + " " + c.student.lastname) %>
  </h1>
   ${self.editform(c.student)}
</%def>
            
